package com.myacg.editor.common.unit.list.item;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;

import javax.swing.JLabel;

public class TextFlowListItem extends FlowListItem<String>{
	private  JLabel  dataLabel;
	public TextFlowListItem(String id, String data) {
		super(id, data);
		this.setLayout(new FlowLayout(0, 2, 2));
		dataLabel = new JLabel(data);
		this.add(dataLabel);
	}
	/**
	 * 基于原有事件的基础上 重写selected方法
	 */
	@Override
	public void setSelected(boolean selected) {
		super.setSelected(selected);
		if(selected){
			this.dataLabel.setForeground(Color.darkGray);
		}else{
			this.dataLabel.setForeground(Color.black);
		}
	}
	@Override
	public void drawContent(Graphics g, String data) {
		   this.dataLabel.setText(data);
	}

}
